<template>
  <div>
    <h1>我是购物车组件111</h1>
    <h1>{{uid}}</h1>
    <h1>{{$route.params.uid}}</h1>
    <button @click="$router.go(-1)">后退</button>
    <!-- v-model的修饰符 -->
    <br>
    <!-- .number  输入框内容转为数字 -->
    <input type="text"
           v-model.number="mytxt">
    <!-- .trim  去除首尾的空格 -->
    <input type="text"
           v-model.trim="sas">
    <!-- .lazy   把v-model 时时触发（input事件）变为change事件触发-->
    <input v-model.lazy="msg">
  </div>
</template>
<script>
export default {
  name: 'cart',
  data () {
    return {
      uid: "",
      pid: "",
      mytxt: '',
      sas: "",
      msg: ""
    }
  },
  watch: {
    mytxt (newVal, oldVal) {
      console.log(newVal)
    },
    sas (newVal) {
      console.log(newVal)
    },
    msg (newVal) {
      console.log(newVal)
    }
  },
  beforeCreate () {

  },
  created () {
    // 接受参数 要和传参方式保持一致
    // this.$route.query 
    // this.$route.params 
    // console.log(this.$route.query);//{}
    console.log(this.$route.params);
    this.uid = this.$route.params.uid;
    console.log(this.uid)
  },
  beforeMount () {

  },
  mounted () {

  },
  beforeUpdate () {

  },
  updated () {

  },
  beforeDestroy () {

  },
  destroyed () {

  },
}
</script>
<style lang="less">
</style>